package Work4.Slay_the_Maze.Cards;

import java.util.ArrayList;

import Work4.Slay_the_Maze.Cards.Interface.*;
import Work4.Slay_the_Maze.Monsters.Monster;
import Work4.Slay_the_Maze.Player.Player;

public class defense extends Cards implements Defense {
	private int armor=8;
	public int getArmor() {
		return armor;
	}
	public void setArmor(int armor) {
		this.armor = armor;
	}
	public defense() {
		super(1,"防御","技能牌",25);
	}
	
	public defense(defense other) {
        // 调用父类的构造函数，复制父类属性
        super(other.getCost(), other.getName(), other.getCardtype(),other.getValue());
        // 复制 Defense 类的特定属性
        this.armor = other.armor;
    }

    // 克隆方法
    @Override
    public Cards clone() {
        return new defense(this);  // 使用拷贝构造函数
    }
	
	@Override
	public void PrintInfo() {
		System.out.println("费用:"+getCost()+"   "+getName()+"  效果:获得8点护甲"+"   "+getCardtype());
	}
	
	@Override
	public void Defense(Player user) {
		int temparmor=(int)(armor*user.getArmorrate())+user.getAgility();
		user.setArmor(user.getArmor()+temparmor);
		System.out.println("获得"+temparmor+"护甲");
	}
	
	@Override
	public void Useit(Player player,ArrayList<Monster> monsters) {
		Defense(player);
	}
	
}